package toolkit.tianshi;

import java.io.Console;

import com.google.common.base.CharMatcher;
import org.junit.jupiter.api.Test;
import toolkit.tianshi.common.regular.Expression;
import toolkit.tianshi.common.regular.Matching;
import toolkit.tianshi.common.regular.RegularExpression;

public class regular {

//    public static void main(String[] args) {
////        String phone = readString("输入测试内容：");
//        String phone = "12345678901";
//        System.out.println(RegularExpression.checkMobileNumber(phone, RegularExpression.PhoneNumber.NORMAL));
//    }

    private static String readString(String prompt) {
        Console console = System.console();
        if (console == null) {
            throw new IllegalStateException("不能使用控制台");
        }
        return console.readLine(prompt);
    }

    @Test
    void matchingTest() {
        Matching match = new Matching();
        String[] matchings = match.matchings("[0-9]|[a-z]|[A-Z]|\\/|:|\\.|-", "");
        for (String matching : matchings){
            System.out.println(matching);
        }
        System.out.println(match.matching("[0-9]|[a-z]|[A-Z]|\\/|:|\\.|-", ""));
    }

    @Test
    void testRegular(){
        String str = CharMatcher.JAVA_LETTER_OR_DIGIT.retainFrom(" /s【】/1-EO【】LbrjWrj【】bAZ4Y【】LUc【】hz6Q");
        String url = " /s【】/1-EO【】LbrjWrj【】bAZ4Y【】LUc【】hz6Q";
        System.out.println(url.replaceAll("【","").replaceAll("】",""));
        System.out.println(str);
    }
}
